package com.db;
import javax.naming.*;
import javax.sql.*;
import java.sql.*;
public class ConnectionFactory {
    private static Connection conn;

    public static Connection getConnection() throws NamingException, SQLException {
        Context ctx = (Context) new InitialContext();
        Context envctx = (Context) ctx.lookup("java:/comp/env");
        DataSource ds = (DataSource) envctx.lookup("jdbc/qy");
        conn = ds.getConnection();
        return conn;
    }
}
